﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dblayer;
using Modellayer;

namespace Controllayer
{
    public class ReservationCtr
    {
        DbReservation dbR;
        PersonCtr pCtr;
        ShowCtr sCtr;

        public ReservationCtr()
        {
            dbR = new DbReservation();
            pCtr = new PersonCtr();
            sCtr = new ShowCtr();
        }

        public void createReservation(Person p, Show s, List<Seat> seats)
        {
            Reservation res = new Reservation();
            res.person = p;
            res.show = s;
            res.reservationsId = dbR.getReservationsNumber() + 1;
            dbR.createReservation(res);
            foreach (Seat seat in seats)
            {
                res.seats.Add(seat);
                sCtr.reserveSeat(s, seat.seatNumber, res.reservationsId);
            }
        }



    }
}
